/** Project 3
 *
 * @Group Members
 * 	Brentton Garber - mrbrentgarber@gmail.com
 * 	Georgii Tkachuk - georgii.t@gmail.com
 * 	Lucas Bridge - ltbridge@asu.edu
 * 	Austin Burnham - burnhamaustin@gmail.com
 * 	Kevin Greenberg - kgreenbe@asu.edu
 * @Revision
 *
 * @Since
 *
 */

#include <iostream>
#include "Literal.h"

/**
 * 	This is the constructor for the Literal Class.
 *
 *	When the class is constructed the passed in LiteralType is stored to the private class variable type
 *
 *	@param	ltype       This is the passed in LiteralType.
 */
Literal::Literal(LiteralType ltype)
{
	type = ltype;
}

/**
 * 	This is the deconstructor for the Literal Class.
 *
 *	This is used when deconstructing the Literal class
 */
Literal::~Literal()
{
	//used as a deconstructor
}

/**
 * 	This sets the variable value for int.
 *
 *	Sets the variable value to the int of the passed in variable a.
 *
 *	@param	a           The passed in int that will be assigned to value.
 */
void Literal::SetValue(int a)
{
	value.integer = a;
}

/**
 * 	This sets the variable value for float.
 *
 *	Sets the variable value to the float of the passed in variable a.
 *
 *	@param	a           The passed in float that will be assigned to value.
 */
void Literal::SetValue(float a)
{
	value.real = a;
}

/**
 * 	This sets the variable value for string.
 *
 *	Sets the variable value to the string of the passed in variable a.
 *
 *	@param	a           The passed in string that will be assigned to value.
 */
void Literal::SetValue(string a)
{
    int length = 0;
    do{
        value.str[length] = a[length];
        length++;
    }while(a[length] != '\0');
    
}

/**
 * 	This retrieves the string stored in value.
 *
 *	Retrieves the char array stored in value and returns a string.
 *
 *	@return	Returns a string.
 */
string Literal::GetStringValue()
{
	return value.str;
}

/**
 * 	This retrieves the int stored in value.
 *
 *	Retrieves the int stored in value and returns an int.
 *
 *	@return	Returns an int.
 */
int Literal::GetIntValue()
{
	return value.integer;
}

/**
 * 	This retrieves the float stored in value.
 *
 *	Retrieves the float stored in value and returns a float.
 *
 *	@return	Returns a float.
 */
float Literal::GetFloatValue()
{
	return value.real;
}

/**
 * 	This returns the LiteralType type.
 *
 *	This returns the value stored in the private class variable type.
 *
 *	@return	Returns a LiteralType.
 */
LiteralType Literal::GetType()
{
    	return type;
}


